package com.wesley.method;

public class Demo03 {
    public static void main(String[] args) {
        int larger = max(10,20);
        System.out.println(larger);

        System.out.println(max(10,20));

        System.out.println(max(10.0,20.0));

        System.out.println(max(10,20,30));
        System.out.println(max(10,10,30));

    }

    //整数比大小
    public static int max(int num1, int num2){
        int result = 0;

        if(num1 == num2){
            System.out.println("数值相等");
            return 0;//终止方法
        }

        if(num1 > num2){
            result = num1;
        }else {
            result = num2;
        }

        return result;
    }

    //小数比大小
    public static double max(double num1, double num2){
        double result = 0;

        if(num1 == num2){
            System.out.println("数值相等");
            return 0;//终止方法
        }

        if(num1 > num2){
            result = num1;
        }else {
            result = num2;
        }

        return result;
    }

    //三个整数比大小
    public static int max(int num1, int num2, int num3){
        int result = 0;

        if ((num1 == num2) && (num2 == num3)){
            System.out.println("都相等");
            return 0;//终止方法
        }

        if(num1 > num2 && num1 > num3){
            result = num1;
        }else if(num2 > num3){
            result = num2;
        }else {
            result = num3;
        }

        return result;
    }
}
